// // Copyright (c) 2009 All Right Reserved // // vl // // 2009-01-01 // Contains ... using System.Collections.Generic; using System.Collections.ObjectModel; using System.Globalization; using System.Linq; using System.Text; using System.Xml.Serialization; namespace LargoCommon.Music { /// /// Rhythmic Struct Collection. /// [XmlRoot] public sealed class RhythmicStructureCollection : Collection { #region Constructors /// /// Initializes a new instance of the RhythmicStructureCollection class. /// public RhythmicStructureCollection() { } /// /// Initializes a new instance of the RhythmicStructureCollection class. /// /// Given list. public RhythmicStructureCollection(IList givenList) : base(givenList) { } #endregion #region Properties /// Gets list of all already defined tones. /// Property description. public string UniqueIdentifier { get { var ident = new StringBuilder(); ident.Append(string.Format(CultureInfo.CurrentCulture, "#{0}#", this.Count)); foreach (var sc in this.Where(rs => rs.GetStructuralCode != null).SelectMany(rs => rs.GetStructuralCode)) { ident.Append(sc); } //// ElementSchema, DecimalNumber, ms.StructuralCode return ident.ToString(); } } /// /// Is Equal To. /// /// Rhythmic Struct Collection. /// Returns value. [JetBrains.Annotations.PureAttribute] public bool IsEqualTo(RhythmicStructureCollection rhythmicStructures) { if (rhythmicStructures == null) { return false; } return string.CompareOrdinal(this.UniqueIdentifier, rhythmicStructures.UniqueIdentifier) == 0; } #endregion } }